Optimal. Leaf size=144 \[ \frac {a^4 (B+4 i A) \log (\sin (c+d x))}{d}+\frac {a^4 (7 B+4 i A) \log (\cos (c+d x))}{d}-8 a^4 x (A-i B)-\frac {3 B \left (a^4+i a^4 \tan (c+d x)\right )}{d}+\frac {(-B+2 i A) \left (a^2+i a^2 \tan (c+d x)\right )^2}{2 d}-\frac {a A \cot (c+d x) (a+i a \tan (c+d x))^3}{d} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.43, antiderivative size = 144, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 5, integrand size = 34, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.147, Rules used = {3593, 3594, 3589, 3475, 3531} \[ \frac {(-B+2 i A) \left (a^2+i a^2 \tan (c+d x)\right )^2}{2 d}+\frac {a^4 (B+4 i A) \log (\sin (c+d x))}{d}+\frac {a^4 (7 B+4 i A) \log (\cos (c+d x))}{d}-8 a^4 x (A-i B)-\frac {3 B \left (a^4+i a^4 \tan (c+d x)\right )}{d}-\frac {a A \cot (c+d x) (a+i a \tan (c+d x))^3}{d} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3475
Rule 3531
Rule 3589
Rule 3593
Rule 3594
Rubi steps
\begin {align*} \int \cot ^2(c+d x) (a+i a \tan (c+d x))^4 (A+B \tan (c+d x)) \, dx &=-\frac {a A \cot (c+d x) (a+i a \tan (c+d x))^3}{d}+\int \cot (c+d x) (a+i a \tan (c+d x))^3 (a (4 i A+B)+a (2 A+i B) \tan (c+d x)) \, dx\\ &=-\frac {a A \cot (c+d x) (a+i a \tan (c+d x))^3}{d}+\frac {(2 i A-B) \left (a^2+i a^2 \tan (c+d x)\right )^2}{2 d}+\frac {1}{2} \int \cot (c+d x) (a+i a \tan (c+d x))^2 \left (2 a^2 (4 i A+B)+6 i a^2 B \tan (c+d x)\right ) \, dx\\ &=-\frac {a A \cot (c+d x) (a+i a \tan (c+d x))^3}{d}+\frac {(2 i A-B) \left (a^2+i a^2 \tan (c+d x)\right )^2}{2 d}-\frac {3 B \left (a^4+i a^4 \tan (c+d x)\right )}{d}+\frac {1}{2} \int \cot (c+d x) (a+i a \tan (c+d x)) \left (2 a^3 (4 i A+B)-2 a^3 (4 A-7 i B) \tan (c+d x)\right ) \, dx\\ &=-\frac {a A \cot (c+d x) (a+i a \tan (c+d x))^3}{d}+\frac {(2 i A-B) \left (a^2+i a^2 \tan (c+d x)\right )^2}{2 d}-\frac {3 B \left (a^4+i a^4 \tan (c+d x)\right )}{d}+\frac {1}{2} \int \cot (c+d x) \left (2 a^4 (4 i A+B)-16 a^4 (A-i B) \tan (c+d x)\right ) \, dx-\left (a^4 (4 i A+7 B)\right ) \int \tan (c+d x) \, dx\\ &=-8 a^4 (A-i B) x+\frac {a^4 (4 i A+7 B) \log (\cos (c+d x))}{d}-\frac {a A \cot (c+d x) (a+i a \tan (c+d x))^3}{d}+\frac {(2 i A-B) \left (a^2+i a^2 \tan (c+d x)\right )^2}{2 d}-\frac {3 B \left (a^4+i a^4 \tan (c+d x)\right )}{d}+\left (a^4 (4 i A+B)\right ) \int \cot (c+d x) \, dx\\ &=-8 a^4 (A-i B) x+\frac {a^4 (4 i A+7 B) \log (\cos (c+d x))}{d}+\frac {a^4 (4 i A+B) \log (\sin (c+d x))}{d}-\frac {a A \cot (c+d x) (a+i a \tan (c+d x))^3}{d}+\frac {(2 i A-B) \left (a^2+i a^2 \tan (c+d x)\right )^2}{2 d}-\frac {3 B \left (a^4+i a^4 \tan (c+d x)\right )}{d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] time = 11.53, size = 1122, normalized size = 7.79 \[ a^4 \left (\frac {x (\cot (c+d x)+i)^4 (B+A \cot (c+d x)) \left (-22 A \cos ^4(c)+\frac {17}{2} i B \cos ^4(c)-4 i A \cot (c) \cos ^4(c)-B \cot (c) \cos ^4(c)+50 i A \sin (c) \cos ^3(c)+\frac {55}{2} B \sin (c) \cos ^3(c)+60 A \sin ^2(c) \cos ^2(c)-45 i B \sin ^2(c) \cos ^2(c)+2 A \cos ^2(c)-\frac {7}{2} i B \cos ^2(c)-40 i A \sin ^3(c) \cos (c)-40 B \sin ^3(c) \cos (c)-6 i A \sin (c) \cos (c)-\frac {21}{2} B \sin (c) \cos (c)-14 A \sin ^4(c)+\frac {37}{2} i B \sin ^4(c)-6 A \sin ^2(c)+\frac {21}{2} i B \sin ^2(c)+(4 \cos (2 c) B-3 B+4 i A \cos (2 c)) \csc (c) \sec (c) (\cos (4 c)-i \sin (4 c))+2 i A \sin ^4(c) \tan (c)+\frac {7}{2} B \sin ^4(c) \tan (c)+2 i A \sin ^2(c) \tan (c)+\frac {7}{2} B \sin ^2(c) \tan (c)\right ) \sin ^5(c+d x)}{(\cos (d x)+i \sin (d x))^4 (A \cos (c+d x)+B \sin (c+d x))}+\frac {(\cot (c+d x)+i)^4 (B+A \cot (c+d x)) (4 i A \cos (2 c)+B \cos (2 c)+4 A \sin (2 c)-i B \sin (2 c)) \left (-i \tan ^{-1}(\tan (5 c+d x)) \cos (2 c)-\tan ^{-1}(\tan (5 c+d x)) \sin (2 c)\right ) \sin ^5(c+d x)}{d (\cos (d x)+i \sin (d x))^4 (A \cos (c+d x)+B \sin (c+d x))}+\frac {(\cot (c+d x)+i)^4 (B+A \cot (c+d x)) (4 i A \cos (2 c)+7 B \cos (2 c)+4 A \sin (2 c)-7 i B \sin (2 c)) \left (\frac {1}{2} \cos (2 c) \log \left (\cos ^2(c+d x)\right )-\frac {1}{2} i \log \left (\cos ^2(c+d x)\right ) \sin (2 c)\right ) \sin ^5(c+d x)}{d (\cos (d x)+i \sin (d x))^4 (A \cos (c+d x)+B \sin (c+d x))}+\frac {(\cot (c+d x)+i)^4 (B+A \cot (c+d x)) (4 i A \cos (2 c)+B \cos (2 c)+4 A \sin (2 c)-i B \sin (2 c)) \left (\frac {1}{2} \cos (2 c) \log \left (\sin ^2(c+d x)\right )-\frac {1}{2} i \log \left (\sin ^2(c+d x)\right ) \sin (2 c)\right ) \sin ^5(c+d x)}{d (\cos (d x)+i \sin (d x))^4 (A \cos (c+d x)+B \sin (c+d x))}+\frac {(A-i B) (\cot (c+d x)+i)^4 (B+A \cot (c+d x)) (8 i d x \sin (4 c)-8 d x \cos (4 c)) \sin ^5(c+d x)}{d (\cos (d x)+i \sin (d x))^4 (A \cos (c+d x)+B \sin (c+d x))}+\frac {(\cot (c+d x)+i)^4 (B+A \cot (c+d x)) \sec (c) (\cos (4 c)-i \sin (4 c)) (A \sin (d x)-4 i B \sin (d x)) \tan (c+d x) \sin ^4(c+d x)}{d (\cos (d x)+i \sin (d x))^4 (A \cos (c+d x)+B \sin (c+d x))}+\frac {A (\cot (c+d x)+i)^4 (B+A \cot (c+d x)) \csc (c) (\cos (4 c)-i \sin (4 c)) \sin (d x) \sin ^4(c+d x)}{d (\cos (d x)+i \sin (d x))^4 (A \cos (c+d x)+B \sin (c+d x))}+\frac {(\cot (c+d x)+i)^4 (B+A \cot (c+d x)) \left (\frac {1}{2} B \cos (4 c)-\frac {1}{2} i B \sin (4 c)\right ) \tan ^2(c+d x) \sin ^3(c+d x)}{d (\cos (d x)+i \sin (d x))^4 (A \cos (c+d x)+B \sin (c+d x))}\right ) \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [B] time = 0.76, size = 254, normalized size = 1.76 \[ \frac {10 \, B a^{4} e^{\left (4 i \, d x + 4 i \, c\right )} + {\left (-4 i \, A - 2 \, B\right )} a^{4} e^{\left (2 i \, d x + 2 i \, c\right )} + {\left (-4 i \, A - 8 \, B\right )} a^{4} + {\left ({\left (4 i \, A + 7 \, B\right )} a^{4} e^{\left (6 i \, d x + 6 i \, c\right )} + {\left (4 i \, A + 7 \, B\right )} a^{4} e^{\left (4 i \, d x + 4 i \, c\right )} + {\left (-4 i \, A - 7 \, B\right )} a^{4} e^{\left (2 i \, d x + 2 i \, c\right )} + {\left (-4 i \, A - 7 \, B\right )} a^{4}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} + 1\right ) + {\left ({\left (4 i \, A + B\right )} a^{4} e^{\left (6 i \, d x + 6 i \, c\right )} + {\left (4 i \, A + B\right )} a^{4} e^{\left (4 i \, d x + 4 i \, c\right )} + {\left (-4 i \, A - B\right )} a^{4} e^{\left (2 i \, d x + 2 i \, c\right )} + {\left (-4 i \, A - B\right )} a^{4}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} - 1\right )}{d e^{\left (6 i \, d x + 6 i \, c\right )} + d e^{\left (4 i \, d x + 4 i \, c\right )} - d e^{\left (2 i \, d x + 2 i \, c\right )} - d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [B] time = 3.06, size = 337, normalized size = 2.34 \[ \frac {A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 2 \, {\left (4 i \, A a^{4} + 7 \, B a^{4}\right )} \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1\right ) + 4 \, {\left (-8 i \, A a^{4} - 8 \, B a^{4}\right )} \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + i\right ) - 2 \, {\left (-4 i \, A a^{4} - 7 \, B a^{4}\right )} \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1\right ) - 2 \, {\left (-4 i \, A a^{4} - B a^{4}\right )} \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right ) - \frac {8 i \, A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 2 \, B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + A a^{4}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )} - \frac {12 i \, A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} + 21 \, B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{4} + 4 \, A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 16 i \, B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 24 i \, A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 46 \, B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 4 \, A a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 16 i \, B a^{4} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 12 i \, A a^{4} + 21 \, B a^{4}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )}^{2}}}{2 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [A] time = 0.40, size = 165, normalized size = 1.15 \[ -8 A \,a^{4} x +\frac {A \,a^{4} \tan \left (d x +c \right )}{d}-\frac {8 A \,a^{4} c}{d}+\frac {a^{4} B \left (\tan ^{2}\left (d x +c \right )\right )}{2 d}+\frac {7 a^{4} B \ln \left (\cos \left (d x +c \right )\right )}{d}+8 i B x \,a^{4}+\frac {4 i A \,a^{4} \ln \left (\sin \left (d x +c \right )\right )}{d}+\frac {4 i A \,a^{4} \ln \left (\cos \left (d x +c \right )\right )}{d}-\frac {4 i a^{4} B \tan \left (d x +c \right )}{d}+\frac {8 i B \,a^{4} c}{d}-\frac {A \cot \left (d x +c \right ) a^{4}}{d}+\frac {a^{4} B \ln \left (\sin \left (d x +c \right )\right )}{d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.88, size = 104, normalized size = 0.72 \[ \frac {B a^{4} \tan \left (d x + c\right )^{2} - 16 \, {\left (d x + c\right )} {\left (A - i \, B\right )} a^{4} + 2 \, {\left (-4 i \, A - 4 \, B\right )} a^{4} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) + 2 \, {\left (4 i \, A + B\right )} a^{4} \log \left (\tan \left (d x + c\right )\right ) + 2 \, {\left (A - 4 i \, B\right )} a^{4} \tan \left (d x + c\right ) - \frac {2 \, A a^{4}}{\tan \left (d x + c\right )}}{2 \, d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 6.56, size = 110, normalized size = 0.76 \[ \frac {B\,a^4\,{\mathrm {tan}\left (c+d\,x\right )}^2}{2\,d}+\frac {a^4\,\ln \left (\mathrm {tan}\left (c+d\,x\right )\right )\,\left (B+A\,4{}\mathrm {i}\right )}{d}-\frac {8\,a^4\,\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (B+A\,1{}\mathrm {i}\right )}{d}-\frac {A\,a^4\,\mathrm {cot}\left (c+d\,x\right )}{d}-\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (B\,a^4\,1{}\mathrm {i}+a^4\,\left (3\,B+A\,1{}\mathrm {i}\right )\,1{}\mathrm {i}\right )}{d} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F(-2)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: NotInvertible} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________